<?php
/**
 * Created by PhpStorm.
 * User: Jerry
 * Date: 2016/10/25
 * Time: 9:15
 */

namespace SDXApi\Model;


use Think\Model;

/**
 * Class SearchHotModel
 * @package SDXApi\Model
 */
class SearchHotModel extends Model
{

    /**
     * @var string
     */
    protected $tableName = 'search_hot';

    /**
     * @return mixed
     */
    public function get_search_hots()
    {
        return $this->field('id,name,is_extrude')->limit(20)->order('sort asc')->select();
    }

    /**
     * 点击次数加一
     * @param $id
     * @return bool
     */
    public function add_search_hot_count($id)
    {
        $where = array(
            'id' => $id,
        );

        return $this->where($where)->setInc('count');
    }
}